import request from "@/base/request";
import {ref} from 'vue'
export default function(){
    const dailyWordParm={
        token:'inX1SwqXLIaGCang',
        format:'json',
        typeid:'23'
    }

    const dailyWord=ref<string>('加载中.....')
    
    //https://www.alapi.cn/api/view/7
    async function getDailyWord() {
        const response=await request.post("https://v2.alapi.cn/api/mingyan",dailyWordParm)
        if(response.data.code===200){
            if(response.data.data.content.length>=86)getDailyWord()
            else dailyWord.value=response.data.data.content
        }else{
            dailyWord.value=`加载失败，请刷新重试`
        }
    } 
    return {dailyWord,getDailyWord}
}